<?php

/**
 * Nodo form base class.
 *
 * @method Nodo getObject() Returns the current form's model object
 *
 * @package    hipermedio
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseNodoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'uuid'          => new sfWidgetFormInputText(),
      'nodo_padre_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Nodo'), 'add_empty' => true)),
      'hipermedio_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Hipermedio'), 'add_empty' => false)),
      'tag_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Tag'), 'add_empty' => false)),
      'medio_id'      => new sfWidgetFormInputText(),
      'nombre'        => new sfWidgetFormInputText(),
      'tipo_medio'    => new sfWidgetFormInputText(),
      'posicion_x'    => new sfWidgetFormInputText(),
      'posicion_y'    => new sfWidgetFormInputText(),
      'created_at'    => new sfWidgetFormDateTime(),
      'updated_at'    => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'uuid'          => new sfValidatorString(array('max_length' => 200)),
      'nodo_padre_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Nodo'), 'required' => false)),
      'hipermedio_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Hipermedio'))),
      'tag_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Tag'))),
      'medio_id'      => new sfValidatorInteger(array('required' => false)),
      'nombre'        => new sfValidatorString(array('max_length' => 100)),
      'tipo_medio'    => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'posicion_x'    => new sfValidatorInteger(array('required' => false)),
      'posicion_y'    => new sfValidatorInteger(array('required' => false)),
      'created_at'    => new sfValidatorDateTime(),
      'updated_at'    => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('nodo[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Nodo';
  }

}
